home *** CD-ROM | disk | FTP | other *** search
- Path: jupiter.planet.net!usenet
- From: cygnusx@planet.net (David)
- Newsgroups: comp.lang.c
- Subject: HELP- PASSING STRUCTURE IN FUNCTION PROTOTYPE?
- Date: Sat, 20 Apr 1996 02:55:39 GMT
- Organization: Planet Access Networks - Stanhope, NJ
- Message-ID: <31784e1f.4961188@news.planet.net>
- NNTP-Posting-Host: newt13.planet.net
- X-Newsreader: Forte Agent .99d/32.182
-
-
- I have this pretty simple program that accepts a first name, last name
- and salary using a structure type called (employee) The data is
- input into an array called (data) which I kept small for the time
- being. I want to pass it to a function called (morethan) which then
- determines which persons exceed the the salary cap I have declared and
- print out there names.
-
- When I try to compile I get only one error. It is at the beginning of
- the function prototype (morethan) and this is the error statment?? .
-
- [ ) expected ] .
-
- Is this somthing with the way I wrote the program or just something in
- this line? I am not sure this is a good way to go about this program .
-
- thanx code below................. David
-
- #include<stdio.h>
-
- struct employee {
-
- char first[10];
- char last [10];
- float salary;
-
- };
-
- morethan(struct employee,float);
-
- main(){
-
- int ctr;
- struct employee data[4];
-
-
- for (ctr=0;ctr<4;ctr++)
-
- {printf("please enter first name:\n");
-
- gets(data[ctr].first);
- puts("what is the last name:\n");
- gets(data[ctr].last);
- puts("what is the salary:\n");
- scanf("%f",&data[ctr].salary);
- getchar();}
-
- for (ctr=0;ctr<4;ctr++)
-
- {printf("%s\n",data[ctr].first);
- printf("%s\n",data[ctr].last);
- printf("%f\n",data[ctr].salary);}
-
- morethan(data[4],1000);
-
-
- return 0;}
-
-
- morethan (struct employee a[],b) /* error is on this line */
-
-
- { for(i=0;i<4;i++)
-
-
- if(data[i].salary > b)
-
- printf("%s",data[i].first);
- printf("%s",data[i].last);}
-
-